#include<bits/stdc++.h>
using namespace std;
int n,a[100005],jsq,b[100005];
// bool cmp(int x,int y){
//     if(x>y) return 1;
//     else return 0;
// }
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        b[a[i]]++;
    }
    //sort(a+1,a+n+1,cmp);
    ////reverse(a+1,a+n+1);
    int jg=0;
    for(int i=1;i<=100000;i++){
        if(b[i]!=0) {
            swap(b[i-jg],b[i]);
            //cout<<i<<' '<<b[i]<<'\n';
            
        }
        else if(b[i]==0) jg++;
    }
    for(int i=1;i<=n;i++){
        // cout<<b[i]<<'\n';
        if(b[i]==0) break;
    }
    for(int i=1;i<=n;i++){
        // if(b[i]) cout<<i<<' '<<b[i]<<'\n';
        int dml=b[i],x=i-1;
        for(int j=1;j<=dml;j++){
            if(x==0) break;
            if(b[x]>0){
                b[x]--;
            }
            else if(b[x]==0){
                x--;
            }
        }
    }
    for(int i=1;i<=n;i++) if(b[i]) jsq+=b[i];
    cout<<jsq;
    return 0;
}
